<?php
class ControllerToolOplog extends Controller {
	private $error = array();
	public function index() {
		$this->load->language('tool/backup');
		
		$this->document->setTitle("Operation Logs");
		
		$this->load->model('tool/oplog');
		
		$this->data['heading_title'] = "Operation Logs";
		
		$this->data['breadcrumbs'] = array();
		
		$this->data['breadcrumbs'][] = array( 
			'text' => $this->language->get('text_home'), 
			'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'), 
			'separator' => false 
		);
		
		$this->data['breadcrumbs'][] = array( 
			'text' => $this->language->get('heading_title'), 
			'href' => $this->url->link('tool/oplog', 'token=' . $this->session->data['token'], 'SSL'), 
			'separator' => ' :: ' 
		);
		
		if (isset($this->request->get['page'])) {
			$page = $this->request->get['page'];
		}
		else {
			$page = 1;
		}
		
		$url = '';
		if (isset($this->request->get['page'])) {
			$url .= '&page=' . $this->request->get['page'];
		}
		
		$product_total = $this->model_tool_oplog->getTotalLogs();
		
		$results = $this->model_tool_oplog->getLogs($page, $this->config->get('config_admin_limit'));
		$this->data['logs'] = $results;
		$pagination = new Pagination();
		$pagination->total = $product_total;
		$pagination->page = $page;
		$pagination->limit = $this->config->get('config_admin_limit');
		$pagination->text = $this->language->get('text_pagination');
		$pagination->url = $this->url->link('tool/oplog', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
		
		$this->template = 'tool/oplog.tpl';
		$this->children = array( 
			'common/header', 
			'common/footer' 
		);
		
		$this->response->setOutput($this->render());
	}
}
?>